import { defineStore } from 'pinia'
import { getCinemaList } from '@/api/modules/cinema'
import type { Cinema } from '@/api/interface';

export const useCinemaStore = defineStore('cinema',{
    state(){
        return {
            items: []  as Cinema.Item[]  //用于存放影院列表数据
        }
    },

    actions:{
        //获取影院列表数据
        async getItems(data:{cityId:number;ticketFlag:number}){
            const {cinemas} = await getCinemaList(data)
            this.items = cinemas

            return cinemas
        }
    }
})